import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import DictionaryListView from '../views/DictionaryListView.vue'
import WordView from '@/views/WordView.vue';
// import WordItemComponent from "@/components/WordItemComponent.vue";
import WordListView from '@/views/WordListView.vue'
import  MineDictation  from "@/views/MineDictation.vue";
import LabelManagerView from "@/views/LabelManagerView.vue";
import DIYWordView from "@/views/DIYWordView.vue";
import BaiduHanyuSearchViewVue from '@/views/BaiduHanyuSearchView.vue';
import SelectBookView from '@/views/practice/SelectBookView.vue';
import ListeningWritingView from '@/views/practice/ListeningAndWrittingView.vue'
import ChooseView from '@/views/practice/ChooseView.vue'
import DefaultBookListView from '@/views/default/DefaultBookListView.vue'
import DefaultWordListView from '@/views/default/DefaultWordListView.vue'
import BaiduArticleView from '@/views/article/BaiduArticleView.vue'
import BaiduFanYiSearchViewView from '@/views/BaiduFanYiSearchView.vue';


const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  }, {
    path: '/dict/:type',
    name: 'dictionary',
    component: DictionaryListView
  }, {
    path: '/word_list/:dataFlag/:bookId',
    name: 'word_list',
    component: WordListView
  }, {
    path: '/word/:bookId/:wordId/:default:/:curIndex',
    name: 'word_detail',
    component: WordView
  },{
    path: '/dict/mine',
    name: 'mine_dictation',
    component: MineDictation
  },{
    path: '/dict/label',
    name: 'mine_label',
    component: LabelManagerView
  },{
    path: '/word/diy/:bookId/:wordId/:copy',
    name: 'diy_word',
    component: DIYWordView
  },{
    path: '/search/word/diy/:lang/:word',
    name: 'search_diy_word',
    component: DIYWordView
  },{
    path: '/search/baidu/hanyu',
    name: 'search_hanyu',
    component: BaiduHanyuSearchViewVue
  },{
    path: '/practice/book-list/:option',
    name: 'practice-book-list',
    component: SelectBookView
  },{
    path: '/practice/listening-writing/:bookId',
    name: 'practice-listening-writing',
    component: ListeningWritingView
  },{
    path: '/practice/choose/:bookId',
    name: 'practice-choose',
    component: ChooseView
  },{
    path: '/default/book/list',
    name: 'default-book-list',
    component: DefaultBookListView
  },{
    path: '/default/word/list/:bookId',
    name: 'default-word-list',
    component: DefaultWordListView,
    meta:{
      keepAlive:true
    }
  },{
    path: '/article/baidu/list',
    name: 'article-baidu',
    component: BaiduArticleView
  },{
    path: '/search/baidu/fanyi',
    name: 'search_fanyi',
    component: BaiduFanYiSearchViewView
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
